package com.zxg.web.controller;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author: zhaoxiaoguang
 * @Description:
 * @Date: created in 2018/5/15
 * @Modidied By:
 **/
public class Test {

    public static void main (String args[]) {


        List<String> titles = new ArrayList<String>();
        for (int i = 0; i <= 6; i++) {
            titles.add("44" + i);
        }
        List<String> contents = new ArrayList<String>();
        for (int i = 0; i <= 10; i++) {
            contents.add("44");
        }

        int ALLOW_LENGTH = 3400;
        int size = titles.size() > contents.size() ? contents.size() : titles.size();
        //每次保存条数
        int pageSize = 50;
        int page = size % pageSize > 0 ? size / pageSize + 1 : size / pageSize;
        for (int i = 1; i <= page; i++) {
            int maxSize = i * pageSize > size ? size : i * pageSize;
            List<String> total = new ArrayList<String>();

            for (int j = (i - 1) * pageSize; j < maxSize; j++) {
                if (contents != null && titles != null) {
                    String content = contents.get(j).length() > ALLOW_LENGTH ? contents.get(j).substring(0, ALLOW_LENGTH) : contents.get(j);
                    String title = titles.get(j).length() > ALLOW_LENGTH ? titles.get(j).substring(0, ALLOW_LENGTH) : titles.get(j);
                    total.add(content + title);

                }
            }
            System.out.println(total.toString());
        }
    }
}
